.TH localslackirc 1 "Nov 22, 2023" "IRC gateway for slack"
.SH NAME
localslackirc
\- Creates an IRC server running locally, which acts as a gateway to slack for one user.

.SH SYNOPSIS
localslackirc [OPTIONS]

.SH DESCRIPTION
This command starts an IRC server running on 127.0.0.1:9007 which acts as a gateway to slack for one user.
.br
To connect to multiple instances it is necessary to run multiple instances of this software.
.TP
.SS
.SS Options:
.TP
.B -h, --help
Show the help message and exit.
.TP
.B -v, --version
Show the version and exit.
.TP
.B -p PORT, --port PORT
Set the port number. The default is 9007.
.br
.TP
.B -i IP, --ip IP
Set the IP (Ipv4 only) address to listen to. The default is 127.0.0.1.
.TP
.B -t TOKENFILE, --tokenfile TOKENFILE
Set the token file. The default is ~/.localslackirc.
.TP
.B -c TOKENFILE, --cookiefile TOKENFILE
Set the cookie file. This is only used on slack, and is only useful if your token starts with "xoxc".
.TP
.B -u, --nouserlist
Don't display userlist in the IRC client.
.TP
.B -j, --autojoin
Automatically join all remote channels.
.TP
.B -o, --override
Allow listening on addresses that do not start with 127.*
.br
This is potentially dangerous.
.TP
.B --downloads-directory
Where to create files for automatic downloads. It defaults to /tmp.
.br
The directory must exist and be writeable. Files will automatically be downloaded in it.
.br
No cleaning is automatically performed on it by localslackirc.
.TP
.B --formatted-max-lines
Maximum amount of lines in a formatted text to send to the client rather than store in a file.
.br
When people send logs or otherwise long text content as formatted text, the end result is usually hardly readable in IRC, having the username of the sender and the time in each line.
.br
This option sets a limit for formatted content to be sent as text.
.br
When the limit is exceeded, the formatted text will be stored as a .txt file instead and its URL will be shown in the IRC client.
.br
The files will be saved in the path specified by "downloads directory".
.br
The files are not automatically removed.
.br
Setting to 0 (the default) will send everything to the client and create no text files.
.TP
.B -f --status-file
Path to the file keeping the status. When this is set, it allows for the history to be loaded on start.
.TP
.B --silenced-yellers
Comma separated list of nicknames and channels that are prevented from using general mentions (@here, @channel, @everyone, and the likes).
.br
Since some people are greatly abusing the feature, this is to make them less annoying.
.br
Their messages aren't blocked and are shown as "yelling MESSAGE", but the nickname of the user won't be injected in the message, so the IRC client won't create a notification.
.br
The channels must begin with #.
.br
The threads created from a silenced channel will also be silenced.
.TP
.B -d --debug
Enables debugging logs.
.TP
.B --log-suffix
Instead of using localslackirc as ident for syslog, this appends a custom string, separated by a -.
.br
This is useful when running several instances, to be able to distinguish the logs.
.br
The default .service file uses this. Of course journald keeps track of the services but this makes it easier to have the information on text dumps or other logging daemons such as rsyslog.
.TP
.B --ignored-channels
Comma separated list of channels to ignore and not automatically join on IRC.
.br
It is ignored unless autojoin is set.
.br
If a channel is in this list, the IRC client will not automatically join it, but on slack you will still be inside the channel
.br
This is useful to avoid off topic channels in which coworkers who can't take a hint keep re-inviting.
.br
The ignored channels can be joined again if needed, with a /join #channel command. However the conversation history will not be fetched.
.br
For channel names containing non ascii characters, their ascii representation needs to be used. Use /list to see which that is.
.TP
.B --no-rejoin-on-mention
Normally localslackirc will automatically join channel and threads if someone mentions the user.
.br
When this is set the mentions will be ignored and no channels or threads will be joined upon mention.
.TP
.B --control-socket CONTROL_SOCKET
When used, localslackirc will create a unix socket in the specified path, that can be used by the various lsi-* commands to interact with localslackirc.
.br
Before an IRC client connects to localslackirc, the process is in a dormant unconnected state and is not connected to slack. For this reason the control socket exists only when an IRC client is connected.
.SH TOKEN
The access token is (unless specified otherwise) located in ~/.localslackirc, for information on how to obtain your token, check the README file.
.SH ENVIRONMENT
The following environment variables are used. They override command line settings. The alternatives to switches must contain "true" to work.
.TP
.B COOKIE
Alternative to --cookiefile
.TP
.B DOWNLOADS_DIRECTORY
Alternative to --downloads-directory
.TP
.B FORMATTED_MAX_LINES
Alternative to --formatted-max-lines
.TP
.B PORT
Alternative to --port
.TP
.B TOKEN
Alternative to --tokenfile
.TP
.B PROCESS_OWNER
If running as root, this is the name of the user to switch to. If this is not specified, "nobody" will be used.
.br
This is very useful to start localslackirc as a service and configure which user to use in the configuration file.
.TP
.B IP_ADDRESS
Alternative to --ip
.TP
.B OVERRIDE_LOCAL_IP
Alternative to --override
.TP
.B STATUS_FILE
Path to the status file
.TP
.B AUTOJOIN
Alternative to --autojoin
.br
Set to "true" to enable.
.TP
.B NOUSERLIST
Alternative to --nouserlist
.br
Set to "true" to enable.
.TP
.B DEBUG
Alternative to --debug
.TP
.B LOG_SUFFIX
Alternative to --log-suffix
.TP
.B IGNORED_CHANNELS
Alternative to --ignored-channels
.TP
.B NO_REJOIN_ON_MENTION
Alternative to --no-rejoin-on-mention
.br
Set to "true" to enable.
.TP
.B SILENCED_YELLERS
Alternative to --silenced-yellers
.TP
.B CONTROL_SOCKET
Alternative to --control-socket
.SH Additional IRC commands
Some commands are added, to use some additional features that are present in slack but not IRC.
.SS
.TP
.B /sendfile destination /path/to/file
Sends the specified file to destination.
.br
The destination can be a user or a channel, in which case it must begin with #.
.TP
.B /annoy user [duration]
The indicated user will be annoyed.
.br
This means that whenever a typing event is received from that user, on any channel, a type event on the same channel will be sent back, making the user think you are about to write something too.
.br
duration is the duration of the annoyance in minutes. It defaults to 10.
.SS
.TP
.B /autoreact user probability [reaction] [duration]
To automate reacting to messages, this nice feature is available.
.br
user is the username of the user that we want to react to.
.br
probability is a number between 0 and 1, to decide how much to react.
.br
reaction is the reaction to use. The default is "thumbsup".
.br
duration indicates when to stop doing it, in minutes. Defaults to 10. Setting it to -1 makes it never expire.
.SS

.TP
.B /dropautoreact user
Deletes all the automatic reacts for a given user
.SS

.TP
.B /dropannoy user
Stops annoying the given user
.SS

.TP
.B /listannoy
Lists the users that are currently being annoyed
.SS

.TP
.B /listautoreact
Lists the automatic reactions
.SS


.SH "SEE ALSO"
.BR lsi-send (1), lsi-write (1)


.SH WEB
.BR https://github.com/ltworf/localslackirc

.SH AUTHOR
.nf
Salvo "LtWorf" Tomaselli <tiposchi@tiscali.it>
